package com.zhss.eshop.auth.service;

import com.zhss.eshop.auth.domain.dto.AuthPriorityDTO;
import com.zhss.eshop.auth.service.Impl.operation.PriorityNode;

import java.util.List;

public interface AuthPriorityService{


    Boolean deleteByPrimaryKey(Long id) throws Exception;

    int insertSelective(AuthPriorityDTO record) throws Exception;

    AuthPriorityDTO selectByPrimaryKey(Long id) throws Exception;

    int updateByPrimaryKeySelective(AuthPriorityDTO record) throws Exception;

    List<AuthPriorityDTO> listRootPriorities() throws Exception;

    List<AuthPriorityDTO> listChildPriorities(Long parentId) throws Exception;

    /**
     * 查询账号被授权的权限树
     * @param accountId 账号id
     * @return 权限树
     * @throws Exception
     */
    List<PriorityNode> listAuthorizedByAccountId(
            Long accountId) throws Exception;

    /**
     * 判断账号是否存在对指定编号的权限的授权记录
     * @param accountId 账号id
     * @param code 权限编号
     * @return 是否存在授权记录
     * @throws Exception
     */
    Boolean existAuthorizedByCode(Long accountId, String code) throws Exception;

    /**
     * 判断账号是否存在对指定url的权限的授权记录
     * @param accountId 账号id
     * @param url 权限url
     * @return 是否存在授权记录
     * @throws Exception
     */
    Boolean existAuthorizedByUrl(Long accountId, String url) throws Exception;

}
